package com.go.where.manager.action.go;

import javax.annotation.Resource;

import org.apache.log4j.Logger;

import com.go.where.manager.action.SuperAction;
import com.go.where.manager.common.Constants;
import com.go.where.manager.page.Pagination;
import com.go.where.manager.pojo.ActivitySignupInfo;
import com.go.where.manager.service.ActivitySignupService;

public class ActivitySignupAction extends SuperAction {

	/**
	 * 
	 */
	private static final long serialVersionUID = 4383195694100314090L;
	private static final Logger log = Logger
			.getLogger(ActivitySignupAction.class);

	public Pagination<?> page;

	@Resource(name = "activitySignupService")
	private ActivitySignupService activitySignupService;

	private ActivitySignupInfo activitySignupInfo;
	private ActivitySignupInfo activitySignupInfoQuery;

	private String id;

	/**
	 * 查询列表
	 * 	
	 * @return
	 */
	public String list() {
		if (activitySignupInfoQuery == null) {
			activitySignupInfoQuery = new ActivitySignupInfo();
			activitySignupInfoQuery.setPageSize(Constants.INIT_PAGESIZE);
			activitySignupInfoQuery.setCurrentPage(Constants.INIT_CURRENTPAGE);
		}
		try {
			activitySignupInfoQuery.setIsDelete(Constants.NOT_DELETED);
			page = activitySignupService.queryPage(activitySignupInfoQuery);
		} catch (Exception e) {
			addActionError(e.getMessage());
			log.error("查询信息异常", e);
		}
		return LIST;
	}

	public String falseDelete() {
		activitySignupInfo = new ActivitySignupInfo();
		activitySignupInfo.setId(id);
		activitySignupInfo.setIsDelete(Constants.DELETED);
		try {
			activitySignupService.update(activitySignupInfo);
			redirectionUrl = "activity_signup!list.htm";
			return SUCCESS;
		} catch (Exception e) {
			log.error("删除信息异常", e);
			addActionError("删除信息异常" + e);
			return this.list();
		}
	}

	public Pagination<?> getPage() {
		return page;
	}

	public void setPage(Pagination<?> page) {
		this.page = page;
	}

	public ActivitySignupInfo getActivitySignupInfo() {
		return activitySignupInfo;
	}

	public void setActivitySignupInfo(ActivitySignupInfo activitySignupInfo) {
		this.activitySignupInfo = activitySignupInfo;
	}

	public ActivitySignupInfo getActivitySignupInfoQuery() {
		return activitySignupInfoQuery;
	}

	public void setActivitySignupInfoQuery(
			ActivitySignupInfo activitySignupInfoQuery) {
		this.activitySignupInfoQuery = activitySignupInfoQuery;
	}

	public String getId() {
		return id;
	}

	public void setId(String id) {
		this.id = id;
	}

}
